import React from 'react'
import {useEffect,useState} from "react"
import {useDispatch,useSelector} from "react-redux"
function Anser() {
  let [result,setResult] = useState(0)
  let store = useSelector((state)=>{
    return {
        ...state.Homereducer
    }
  })
  useEffect(()=>{
      console.log(store.arrcopy,11111);
      let ischecked =  store.arrcopy.filter(item=>item.zhen) // 过滤出做对的题
      let sum = ischecked.length * 20 
      setResult(sum)
      
  },[])
  return (
    <div>
        <h2>您的成绩为<b style={{color:"red"}}>{result}</b>分</h2>

    </div>
  )
}

export default Anser